﻿<?php
if(isset($_GET["token"]) && !empty($_GET["token"])){
	$token = $_GET["token"];
	require_once("classes/mustang.php");
	require_once("classes/developer.php"); 
	$mustangDB = new MustangDB();
	$dev = new Developer($mustangDB);
	if($dev->initWithToken($token)){
		$dev->activate();
		$success_msg = "帐号" . $dev->getEmail() . "已激活，请登录";
	}else{
		$error_msg = "激活帐号时发生错误！请重新注册！";
	}
}else{
	$error_msg = "激活帐号时发生错误！请重新注册！";
}
?>
<html>
<head>
<title>
<?php
if(isset($success_msg)){
	echo "帐号激活成功";
	echo "</title><meta http-equiv='refresh' content='5; url=http://localhost:8080/php/login.php' />";
}elseif(isset($error_msg)){
	echo "帐号激活失败</title>";
}
?>
</head>
<body>
<?php
	if(isset($success_msg)){
		echo $success_msg;
		echo "五秒之后跳转到登陆页面,如果没有跳转请点击<a href='http://localhost:8080/php/login.php'>这里</a>";
	}elseif(isset($error_msg)){
		echo $error_msg;
	}
?>
</body>
</html>
